import { useState } from "react"
import { Button } from "antd"
import useCreation from "../../packages/useCreation"

class Foo {
  constructor() {
    this.data = Math.random()
  }

  data: number = 1
}

export default function useCreationDemo() {
  const foo = useCreation(() => new Foo(), [])
  const [, setFlag] = useState({})

  return <>
    <p>useCreation创造的值{foo.data}</p>
    <p>随机数{Math.random()}</p>
    <Button type="primary" onClick={() => setFlag({})}>Rerender</Button>
  </>
}